context free grammar simplification